package com.scpii.api.common.auth.token;

import java.util.Collection;

import com.scpii.api.common.auth.ClientAuthentication;

public interface TokenStore {

	ClientAuthentication readAuthentication(AuthAccessToken token);

	ClientAuthentication readAuthentication(String token);

	void storeAccessToken(AuthAccessToken token,
			ClientAuthentication authentication);

	AuthAccessToken readAccessToken(String tokenValue);

	void removeAccessToken(AuthAccessToken token);

	void storeRefreshToken(AuthRefreshToken refreshToken,
			ClientAuthentication authentication);

	AuthRefreshToken readRefreshToken(String tokenValue);

	ClientAuthentication readAuthenticationForRefreshToken(
			AuthRefreshToken token);

	void removeRefreshToken(AuthRefreshToken token);

	void removeAccessTokenUsingRefreshToken(AuthRefreshToken refreshToken);

	AuthAccessToken getAccessToken(ClientAuthentication authentication);

	Collection<AuthAccessToken> findTokensByDeviceId(Long deviceId);

	Collection<AuthAccessToken> findTokensByClientId(String clientId);

}
